﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace XNA
{
    public class MyXNAButton : VisibleGameEntity
    {
        public MyXNAButton(ContentManager content, string[] strTextures, int nTextures, Vector2 topLeft, Vector2 size)
        {
            InitMyXNAButton(content, strTextures, nTextures, ref topLeft, ref size);
        }

        private void InitMyXNAButton(ContentManager content, string[] strTextures, int nTextures, ref Vector2 topLeft, ref Vector2 size)
        {
            TopLeft = topLeft;
            Size = size;
            Texture2D[] textures = new Texture2D[nTextures];

            for (int i = 0; i < nTextures; i++)
                textures[i] = content.Load<Texture2D>(strTextures[i]);

            sprites = new List<MySprite>();
            MySprite tempSprite = new MySprite(textures, topLeft);

            sprites.Add(tempSprite);
            nSprites = 1;
        }

        public MyXNAButton(ContentManager content, string strTexturePrefix, int nTextures, Vector2 topLeft, Vector2 size)
        {
            string[] strTexture = new string[nTextures];
            for (int i = 0; i < nTextures; i++)
            {
                strTexture[i] = @"Pictures/"+ strTexturePrefix + (i + 1).ToString("00");
            }
            InitMyXNAButton(content, strTexture, nTextures, ref topLeft, ref size);
        }
    }
}
